#!/usr/bin/expect

send "rm /tmp/et/flag\n"

set timeout 5
spawn ssh -l tsunade web1
expect "\$ "
send "sudo killall konoha\n"
expect "tsunade: "
send "konoha\n"
expect "\$ "
send "echo 'stop_all_task' >> /tmp/dtask.log\n"
expect "\$ "
send "exit\n"

set timeout 5
spawn ssh -l tsunade web2
expect "\$ "
send "sudo killall konoha\n"
expect "tsunade: "
send "konoha\n"
expect "\$ "
send "echo 'stop_all_task' >> /tmp/dtask.log\n"
expect "\$ "
send "exit\n"

set timeout 5
spawn ssh -l tsunade db1
expect "\$ "
send "sudo killall konoha\n"
expect "tsunade: "
send "konoha\n"
expect "\$ "
send "echo 'stop_all_task' >> /tmp/dtask.log\n"
expect "\$ "
send "exit\n"

set timeout 5
spawn ssh -l tsunade diag
expect "\$ "
#send "sudo killall konoha\n"
#expect "Password:"
#send "konoha\n"
#expect "\$ "
send "killall memcached\n"
expect "\$ "
send "exit\n"

interact
